package com.weic.manager.controller;

import com.weic.manager.user.vo.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 所有controller的父类
 */
public class BaseController {

//    /**
//     * 返回登入页面
//     * @param request
//     * @param response
//     */
//    @RequestMapping(value = "/")
//    public void home(HttpServletRequest request,HttpServletResponse response){
//       try {
//           response.sendRedirect("/login/loginPage.html");
//       }catch (IOException e){
//           //TODO 日志输出
//       }
//    }

    public Map<String,Object> genAjaxResponse(boolean success,String msg,Object data){
        Map<String,Object> returnMap = new HashMap<>();
        returnMap.put("success",success);
        returnMap.put("msg",msg);
        returnMap.put("data",data);
        return returnMap;
    }

    public void sessionLoginInfo(HttpServletRequest request, UserVO userVO){

    }
}
